﻿$(function(){	
    $('#submit_comment').live('click', function(){           
        submitComment();
    });       
});

function submitComment(){	
	//Create Item object for comment
	var item={
	    newsid: $('.newsid').val(),
		name: $('#name').val(),
		website: $('#website').val(),
		email : $('#email').val(),
		comment: $('#comment').val()
	};
	//Pass comment variables to server using ajax to save state
	var root = $('#WebRoots_GetWebRoot').val();
	$.post(root + 'Modules/viNews/FullView/Comments/SubmitComment.aspx', 'data=' + $.toJSON(item), function (data) {
	    $('.commentsContainer').append(data)
    });	
}